package com.xing.morethread.controller;


import com.xing.morethread.service.ThreadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class testThreadController {

    @Autowired
    private ThreadService threadService;

    @RequestMapping("/do")
    public void domain(){
        System.out.println("mian任务开始执行："
                +Thread.currentThread().getName()+Thread.currentThread().getId());

        threadService.run(); //调用service层的异步方法

        System.out.println("mian任务执行完毕："
                +Thread.currentThread().getName()+Thread.currentThread().getId());
    }
}
